<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>盒子型模的尺寸</title>
</head>
<style>
    #div1{
        width: 100px;
        height: 100px;
        border: 10px solid red;
        margin-left: 20px;
        padding-left:20px;
        box-sizing: border-box;
    }
    #div2{
        width: 50px;
        height: 50px;
        border: 10px solid blue;
    }
</style>
<body>

<div id="div1">
  <div id="div2"></div>
</div>
</body>
</html>